# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pcode2code
pkgver=6.65ae983
pkgrel=8
groups=('blackarch' 'blackarch-decompiler')
pkgdesc='VBA p-code decompiler.'
url='https://github.com/Big5-sec/pcode2code'
arch=('any')
license=('GPL3')
depends=('python' 'python-pip' 'python-pcodedmp')
makedepends=('git' 'dos2unix')
source=("git+https://github.com/Big5-sec/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  dos2unix "$pkgname/$pkgname.py"
  sed -i 's|python|python3|g' "$pkgname/$pkgname.py"
}

package() {
  cd $pkgname

  install -Dm 755 "$pkgname/$pkgname.py" "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

